<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>   
        localStorage.setItem("id", "12222")
        console.log(localStorage.getItem("id"));

        let obj = {
            name :"孙悟空"
        }
        //  本地只能存字符串 如果要存复杂数据类型 先转字符串
        localStorage.setItem("obj", JSON.stringify(obj))
        console.log(JSON.parse(localStorage.getItem("obj")))

        // 生命周期永久 除非手动删除 内存大小 5-10m
        localStorage.removeItem(obj)
    </script>
</body>
</html>